import React from "react";
import styles from "./Post.module.css";
import { Button, Typography } from "antd";
import PostAuthor from "./PostAuthor";
import ReactionButtons from "./ReactionButtons";
export interface PostReactions_dao {
    thumbsUp: number;
    hooray: number;
    heart: number;
    rocket: number;
    eyes: number;
}
export interface Post_dao {
    id: string;
    title: string;
    author: string;
    content: string;
    date: string;
    reactions: PostReactions_dao;
}
interface Props {
    data: Post_dao;
    onDetail: (data: Post_dao) => void;
}
/**
 * 帖子列表
 * */
const Post = ({ data, onDetail }: Props) => {
    return (
        <div className={styles.main}>
            <Typography.Title level={4}>{data.title}</Typography.Title>
            <Typography.Paragraph>
                <PostAuthor userId={data.author} />
                发布于{data.date}
            </Typography.Paragraph>
            <Typography.Paragraph>{data.content}</Typography.Paragraph>
            <Button
                type={"link"}
                onClick={() => {
                    onDetail && onDetail(data);
                }}
            >
                查看详情
            </Button>
            <ReactionButtons data={data} />
        </div>
    );
};
export default Post;
